package com.fansaikj.erp.domain.goods;

/*
 * Copyright © 2020-2035 erupt.xyz All rights reserved.
 * Author: YuePeng (erupts@126.com)
 */

import javax.persistence.*;

import lombok.Data;
import lombok.EqualsAndHashCode;
import xyz.erupt.annotation.*;
import xyz.erupt.annotation.sub_erupt.Power;
import xyz.erupt.annotation.sub_field.*;
import xyz.erupt.annotation.sub_field.sub_edit.*;
import xyz.erupt.jpa.model.BaseModel;

import java.util.Date;

@EqualsAndHashCode(callSuper = true)
@Erupt(name = "物料信息管理", power = @Power(importable = true, export = true))
@Table(name = "erp_goods_info")
@Entity
@Data
public class GoodsInfo extends BaseModel {

    @EruptField(
            views = @View(
                    title = "", show = false
            ),
            edit = @Edit(
                    title = "",
                    type = EditType.INPUT, show = false, notNull = true,
                    inputType = @InputType
            )
    )
    private Long id;

    @ManyToOne
    @EruptField(
            views = @View(
                    title = "物料分类",
                    column = "className"
            ),
            edit = @Edit(
                    title = "物料分类",
                    search = @Search(),
                    type = EditType.REFERENCE_TABLE, notNull = true,
                    referenceTableType = @ReferenceTableType(
                            id = "id",
                            label = "className"
                    )
            )
    )
    private GoodsClass goodsClass;

    @EruptField(
            views = @View(
                    title = "物料名称"
            ),
            edit = @Edit(
                    search = @Search(
                            vague = true
                    ),
                    title = "物料名称",
                    type = EditType.INPUT, notNull = true,
                    inputType = @InputType
            )
    )
    private String goodsName;

    @EruptField(
            views = @View(
                    title = "物料编码"
            ),
            edit = @Edit(
                    search = @Search(
                            vague = true
                    ),
                    title = "物料编码",
                    type = EditType.INPUT, notNull = true,
                    inputType = @InputType
            )
    )
    private String goodsCode;

    @EruptField(
            views = @View(
                    title = "规格型号"
            ),
            edit = @Edit(
                    title = "规格型号",
                    type = EditType.INPUT,
                    inputType = @InputType
            )
    )
    private String goodsNorm;

    @EruptField(
            views = @View(
                    title = "物料单位"
            ),
            edit = @Edit(
                    title = "物料单位",
                    type = EditType.CHOICE,
                    choiceType = @ChoiceType(
                            vl = {
                                    @VL(value = "1", label = "吨"),
                            }
                    )
            )
    )
    private String goodsUnit;

    @EruptField(
            views = @View(
                    title = "材质"
            ),
            edit = @Edit(
                    title = "材质",
                    type = EditType.INPUT,
                    inputType = @InputType
            )
    )
    private String goodsMaterial;

    @EruptField(
            views = @View(
                    title = "创建人", show = false
            ),
            edit = @Edit(
                    title = "创建人",
                    type = EditType.INPUT, show = false,
                    inputType = @InputType
            )
    )
    private String createBy;

    @EruptField(
            views = @View(
                    title = "创建日期", show = false
            ),
            edit = @Edit(
                    title = "创建日期",
                    type = EditType.DATE, show = false,
                    dateType = @DateType
            )
    )
    private Date createTime;

    @EruptField(
            views = @View(
                    title = "更新人", show = false
            ),
            edit = @Edit(
                    title = "更新人",
                    type = EditType.INPUT, show = false,
                    inputType = @InputType
            )
    )
    private String updateBy;

    @EruptField(
            views = @View(
                    title = "更新日期", show = false
            ),
            edit = @Edit(
                    title = "更新日期",
                    type = EditType.DATE, show = false,
                    dateType = @DateType
            )
    )
    private Date updateTime;

    @EruptField(
            views = @View(
                    title = "所属部门",
                    show = false
            ),
            edit = @Edit(
                    title = "所属部门",
                    show = false,
                    type = EditType.INPUT,
                    inputType = @InputType
            )
    )
    private String sysOrgCode;

    @EruptField(
            views = @View(
                    title = "删除状态(0-正常,1-已删除)", show = false
            ),
            edit = @Edit(
                    title = "删除状态(0-正常,1-已删除)",
                    type = EditType.INPUT, show = false,
                    inputType = @InputType
            )
    )
    private String delFlag;

}
